<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="../assets/js/vue.js"></script>
</head>
<body>
    <div id="app">
        <div id="wrap">
            <p>nums的求和：{{sort}}</p>
        </div>
    </div>
    <script>
        new Vue({
            el:"#app",
            data:{
                nums:[1,4,3,5,7,10,12,33,42]  
            },
            computed:{
                sort:function(){
                  return this.nums.reduce((s,n)=>{
                        console.log(s,n);
                        return s+n;
                    })
            }
        }
        })
    </script>
</body>
</html>